<template>
  <div>
    <component
      :is="componentName"
      v-bind="{ relatedData, visible }"
      @close="beforeClose"
    ></component>
  </div>
</template>

<script>
import ProPostloanFile from '@/credit/views/county/unionProvince/components/loanAfter/PostloanFile'
import SelfPostloanFile from '@/credit/views/city/self/components/PostloanFile'
import CityPostloanFile from '@/credit/views/city/mission/PostloanFile'
export default {
  components: {
    ProPostloanFile,
    SelfPostloanFile,
    CityPostloanFile,
  },
  props: {
    relatedData: {
      type: Object,
      default: () => ({}),
    },
    visible: Boolean,
  },
  data() {
    return {}
  },
  computed: {
    componentName() {
      if (+this.relatedData.gua_type === 4 && +this.relatedData.channel_type === 0) {
        return 'pro-postloan-file'
      } else if (+this.relatedData.gua_type === 1) {
        return 'city-postloan-file'
      } else {
        return 'self-postloan-file'
      }
    },
  },
  watch: {},
  created() {},
  methods: {
    beforeClose() {
      this.$emit('close', false)
      this.$emit('update:visible', false)
    },
  },
}
</script>
<style lang="scss" scoped></style>
